//
//  LCYIMMessage.h
//  IMByLinkUs
//
//  Created by lcy on 16/1/19.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, LCYPostingMessageCollectionViewCellType) {
    PostCell,       // 发送消息
    GetCell,        // 获取消息
    GetAudioCell,   // 获取语音消息
    PostAudioCell,  // 发送语音消息
    PostImageCell,  // 发送图片附件
    GetImageCell,   // 获取图片
    PostVideoCell,  // 发送视频附件
    GetVideoCell,   // 获取视频
    PostFileCell,   // 发送文件附件
    GetFileCell,    // 获取文件
    PostLocationCell, // 发送定位
    GetLocationCell   // 获取定位
};

@interface LCYIMMessage : NSObject <NSCoding, NSCopying>


/**
 *  Returns the string identifier that uniquely identifies the user who sent the message.
 */
@property (copy, nonatomic, readonly) NSString *senderId;

/**
 *  Returns the display name for the user who sent the message. This value does not have to be unique.
 */
@property (copy, nonatomic, readonly) NSString *senderDisplayName;

/**
 *  Returns the date that the message was sent.
 */
@property (copy, nonatomic, readonly) NSDate *date;

/**
 *  Returns the body text of the message, or `nil` if the message is a media message.
 *  That is, if `isMediaMessage` is equal to `YES` then this value will be `nil`.
 */
@property (copy, nonatomic) NSString *text;


// 发送附件的文本
//@property (copy, nonatomic) NSMutableAttributedString *attrText;


// cell的类型
@property (assign, nonatomic) LCYPostingMessageCollectionViewCellType cellType;

// audioName
@property (copy, nonatomic) NSString *audioFileName;

// 文件链接
@property (strong, nonatomic) NSURL *fileURL;

// 文件数据
@property (strong, nonatomic) NSData *fileData;

#pragma mark - Initialization

/**
 *  Initializes and returns a message object having the given senderId, displayName, text,
 *  and current system date.
 *
 *  @param senderId    The unique identifier for the user who sent the message. This value must not be `nil`.
 *  @param displayName The display name for the user who sent the message. This value must not be `nil`.
 *  @param text        The body text of the message. This value must not be `nil`.
 *
 *  @discussion Initializing a `JSQMessage` with this method will set `isMediaMessage` to `NO`.
 *
 *  @return An initialized `JSQMessage` object if successful, `nil` otherwise.
 */
+ (instancetype)messageWithSenderId:(NSString *)senderId
                        displayName:(NSString *)displayName
                               text:(NSString *)text;

/**
 *  Initializes and returns a message object having the given senderId, senderDisplayName, date, and text.
 *
 *  @param senderId          The unique identifier for the user who sent the message. This value must not be `nil`.
 *  @param senderDisplayName The display name for the user who sent the message. This value must not be `nil`.
 *  @param date              The date that the message was sent. This value must not be `nil`.
 *  @param text              The body text of the message. This value must not be `nil`.
 *
 *  @discussion Initializing a `JSQMessage` with this method will set `isMediaMessage` to `NO`.
 *
 *  @return An initialized `JSQMessage` object if successful, `nil` otherwise.
 */
- (instancetype)initWithSenderId:(NSString *)senderId
               senderDisplayName:(NSString *)senderDisplayName
                            date:(NSDate *)date
                            text:(NSString *)text;



/**
 *  语音
 *
 *  @param senderId      发送者ID
 *  @param displayName   发送者昵称
 *  @param date          发送日期
 *  @param text          文本
 *  @param audioFileName 语音文件名
 *
 *  @return <#return value description#>
 */
+ (instancetype)messageWithSenderId:(NSString *)senderId
                        displayName:(NSString *)displayName
                               date:(NSDate *)date
                               text:(NSString *)text
                      audioFileName:(NSString *)audioFileName;


- (instancetype)initWithSenderId:(NSString *)senderId
               senderDisplayName:(NSString *)senderDisplayName
                            date:(NSDate *)date
                            text:(NSString *)text
                   audioFileName:(NSString *)audioFileName;

/**
 *  附件
 */

+ (instancetype)messageWithSenderId:(NSString *)senderId
                        displayName:(NSString *)displayName
                               date:(NSDate *)date
                               text:(NSString *)text
                            fileURL:(NSURL *)fileURL
                           fileData:(NSData *)fileData;


- (instancetype)initWithSenderId:(NSString *)senderId
               senderDisplayName:(NSString *)senderDisplayName
                            date:(NSDate *)date
                            text:(NSString *)text
                         fileURL:(NSURL *)fileURL
                        fileData:(NSData *)fileData;

@end
